﻿using System.Windows.Media.Media3D;
using System.ComponentModel;

namespace WpfHeadtracking
{
    public interface IHeadtrackingProvider
    {
        /// <summary>
        /// Position of the head in units of screen height, in a right-handed coordinate system 
        /// using the center of the screen as reference.
        /// </summary>
        /// <remarks>
        /// Usually, the head of a person sitting in front of the screen has coordinates X = 0, Y = 0 and Z > 0.
        /// </remarks>
        Point3D HeadPosition { get; }

        /// <summary>
        /// True if the head is visible to the headtracking system, meaning the value at HeadPosition is the most current.
        /// </summary>
        bool IsHeadtracking { get; }

        /// <summary>
        /// Signalizes the headtracking system that the current position of the head corresponds to the starting head position.
        /// </summary>
        /// <example>
        /// Used in the Wiimote Headtracking system to discover the Wiimote orientation in relation to the screen.
        /// </example>
        void SetHeadOrigin();

        /// <summary>
        /// Starts the headtracking system. The system shouldn't start automatically until this method is called.
        /// </summary>
        void StartHeadtracking();

        /// <summary>
        /// Stop the headtracking system. The system shouldn't stop automatically until this method is called.
        /// </summary>
        void StopHeadtracking();

        /// <summary>
        /// Event handler to notify a change in the head position property.
        /// </summary>
        /// <example>
        /// protected void OnHeadPositionChanged()
        /// {
        ///   PropertyChangedEventHandler handler = HeadPositionChanged;
        ///   if (handler != null)
        ///     handler(this, new PropertyChangedEventArgs("HeadPosition"));
        /// }
        /// </example>
        event PropertyChangedEventHandler HeadPositionChanged;
        
    }
}